<template>
  <div class="amap-form-select">
    <MapSelectForm ref="mapSelectForm" :form-data="myForm" />
    <el-button type="primary" @click="submit">提交</el-button>
    <el-button @click="clean">清空</el-button>
  </div>
</template>

<script>
import MapSelectForm from "@/components/BaseMapSelectForm"
export default {
  name: "AMApFormSelect",
  components: { MapSelectForm },
  data() {
    return {
      myForm: {
        lng: null,
        lat: null,
        address: ''
      }
    };
  },
  mounted() {
    setTimeout(() => {
      this.myForm.lng = 116.407992;
      this.myForm.lat = 39.903293;
      this.myForm.address = '北京市东城区东华门街道东交民巷饭店'
    }, 2000)
  },
  methods: {
    async submit() {
      console.log(await this.$refs.mapSelectForm.getValidateResult());
    },
    clean() {
      this.$refs.mapSelectForm.reset();
    }
  },
};
</script>

<style lang="scss" scoped>
.amap-form-select {
  width: 400px;
  padding: 10px;
}
.lnglat-span {
  margin-left: 5px;
}
</style>
